﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WFCalculator
{
    public partial class Op : Form
    {
        public Op()
        {
            InitializeComponent();
        }

        private void num1_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void num2_TextChanged(object sender, EventArgs e)
        {

        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void calculate_Click(object sender, EventArgs e)
        {
            double i1 = double.Parse(num1.Text);
            double i2 = double.Parse(num2.Text);
            switch (comboBox1.SelectedIndex) {
                case 0:
                    result.Text = (i1 + i2).ToString();
                    break;
                case 1:
                    result.Text = (i1 - i2).ToString();
                    break;
                case 2:
                    result.Text = (i1 * i2).ToString();
                    break;
                case 3:
                    if (i2 == 0) { result.Text = "Error"; break; }
                    result.Text = (i1 / i2).ToString();
                    break;
            }
                
        }
    }
}
